<!-- Edit Address -->
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
  <meta name="layout" content="main" />
  <title>Edit ${company?.name} ${addressType} Address</title>
</head>
<body>
  <div class="body">
    <h1>Edit ${company?.name} ${addressType} Address</h1>
    <g:render template="/common/flashMessage" />
    <g:render template="/common/beanError" model="[bean:address]" />
    <g:form method="post" >
      <input type="hidden" name="id" value="${address?.id}" />
      <input type="hidden" name="version" value="${address?.version}" />
      <input type="hidden" name="companyId" value="${company?.id}" />
      <input type="hidden" name="addressType" value="${addressType}" />
      <div class="dialog">
        <table>
          <tbody>
            <tr class="prop">
              <td valign="top" class="name">
                <label for="line1">Line1:</label>
              </td>
              <td valign="top" class="value ${hasErrors(bean:address,field:'line1','errors')}">
                <input type="text" id="line1" name="line1" value="${fieldValue(bean:address,field:'line1')}"/>
              </td>
            </tr>
            <tr class="prop">
              <td valign="top" class="name">
                <label for="line2">Line2:</label>
              </td>
              <td valign="top" class="value ${hasErrors(bean:address,field:'line2','errors')}">
                <input type="text" id="line2" name="line2" value="${fieldValue(bean:address,field:'line2')}"/>
              </td>
            </tr>
            <tr class="prop">
              <td valign="top" class="name">
                <label for="suite">Suite:</label>
              </td>
              <td valign="top" class="value ${hasErrors(bean:address,field:'suite','errors')}">
                <input type="text" id="suite" name="suite" value="${fieldValue(bean:address,field:'suite')}"/>
              </td>
            </tr>
            <tr class="prop">
              <td valign="top" class="name">
                <label for="city">City:</label>
              </td>
              <td valign="top" class="value ${hasErrors(bean:address,field:'city','errors')}">
                <input type="text" id="city" name="city" value="${fieldValue(bean:address,field:'city')}"/>
              </td>
            </tr>
            <tr class="prop">
              <td valign="top" class="name">
                <label for="state">State:</label>
              </td>
              <td valign="top" class="value ${hasErrors(bean:address,field:'state','errors')}">
                <g:select optionKey="id" from="${State.list()}" name="state.id" value="${address?.state?.id}" ></g:select>
              </td>
            </tr>
            <tr class="prop">
              <td valign="top" class="name">
                <label for="country">Country:</label>
              </td>
              <td valign="top" class="value ${hasErrors(bean:address,field:'country','errors')}">
                <input type="text" id="country" name="country" value="${fieldValue(bean:address,field:'country')}"/>
              </td>
            </tr>
            <tr class="prop">
              <td valign="top" class="name">
                <label for="postalCode">Zip:</label>
              </td>
              <td valign="top" class="value ${hasErrors(bean:address,field:'postalCode','errors')}">
                <input type="text" id="postalCode" name="postalCode" value="${fieldValue(bean:address,field:'postalCode')}"/>
              </td>
            </tr>
          </tbody>
        </table>
      </div>
      <div class="buttons">
        <span class="button"><input type="button" value="Back" onClick="history.back()"></span>
        <span class="button"><g:actionSubmit class="save" value="Update" /></span>
        <span class="button"><g:actionSubmit class="delete" onclick="return confirm('Are you sure?');" value="Delete" /></span>
      </div>
    </g:form>
  </div>
</body>
